Anton Lydike — Blog
Website GitHub

`nixos-rebuild switch --upgrade` *does not* upgrade other channels

Written: 2025-04-23
Tags: #rant #nixos

As the title suggests, this was a doozy to figure out. A while ago I switched from

sudo nix-channel --update
sudo nixos-rebuild switch

to a simpler form, which I thought was identical:

sudo nixos-rebuild switch --upgrade

I only found out just now, that while the former will update all channels, the latter will only update the nixos channel and leave the other ones as is (kind of makes sense, but also quite the footgun).

Now, to use packages where I'd like the latest version available, I have the unstable channel tracked on my machine as well:

> sudo nix-channel --list
nixos https://channels.nixos.org/nixos-24.11
nixos-unstable https://channels.nixos.org/nixos-unstable

But since I switched to nixos-rebuild switch --upgrade, the unstable channel was never updated, eventually falling behind the nixos channel, causing all sorts of funny problems and confusion.

Luckily, there is an "update all channels" flag provided nixos-rebuild switch --upgrade-all. I'll be using that from now on...